#include <stdio.h>
#include <stdlib.h>

//https://www.nowcoder.com/practice/a9e943b0dab142759807d0cfb6863897?tpId=290&tags=&title=&difficulty=0&judgeStatus=0&rp=0&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D290

typedef struct Arr {
    int n;
    int arr[0];
}Arr;

int Campares(const void *x, const void *y) {
    return *(int *)x - *(int *)y;
}

int main() {
    int num1 = 0;
    int num2 = 0;
    scanf("%d%d", &num1, &num2);
    Arr *arr = (Arr *) malloc(sizeof(Arr) + (num1 + num2) * sizeof(int));
    if (arr == NULL) {
        perror("堆区空间开辟失败:");
    }
    arr->n = num1 + num2;
    for (int i = 0; i < arr->n; i++) {
        scanf("%d", &arr->arr[i]);
    }
    qsort(arr->arr, arr->n, sizeof(arr->arr[0]), Campares);
    for (int i = 0; i < arr->n; i++) {
        printf("%d", arr->arr[i]);
    }
    return 0;
}